Fix bearer token approach for Dotnet AF Sample#170
Merged
rahuldevikar761 merged 4 commits intomainfrom Jan 23, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors the authentication approach for non-agentic requests in the .NET Agent Framework sample. The changes remove the OBO (On-Behalf-Of) authentication handler ("me") and replace it with a bearer token-based approach for development and testing scenarios like Playground and WebChat.
Changes:
- Removed "me" authentication handler configuration from appsettings.json
- Simplified ToolingManifest.json to include only mcp_MailTools MCP server
- Added TryGetBearerTokenForDevelopment method to support bearer token authentication from environment variables
- Updated message handling logic to differentiate between agentic (uses auth handler) and non-agentic flows (uses bearer token)
- Changed error handling to gracefully continue without MCP tools instead of throwing exceptions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| dotnet/agent-framework/sample-agent/appsettings.json | Removed "me" MsalUserAuthorization handler configuration to align with new bearer token approach |
| dotnet/agent-framework/sample-agent/ToolingManifest.json | Reduced MCP servers from 7 to 1 (mcp_MailTools only), simplifying the sample configuration |
| dotnet/agent-framework/sample-agent/Agent/MyAgent.cs | Added bearer token support via environment variables, refactored authentication flow to handle agentic vs non-agentic requests differently, and improved error handling for graceful degradation |
pontemonti
reviewed
Jan 22, 2026
pontemonti
reviewed
Jan 22, 2026
pontemonti
approved these changes
Jan 23, 2026
mrunalhirve128
approved these changes
Jan 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.